package com.qiang.work;

import java.io.File;
import java.io.IOException;

public class Demo02 {
    public static void main(String[] args) throws IOException {
        File f1 = new File("D:\\aa");
        /*File[] f2 = f1.listFiles();
        for (File f3 : f2) {
            if ((f3.isFile())) {
                String name = f3.getName();
                String sb = name.substring(name.length() - 3, name.length());
                System.out.println(sb);
            }*/

       /* for (File file : f2) {
            String name = file.getName();
            System.out.println(name);
            System.out.println(file);
        }*/

        getI(f1);

    }

    private static void getI(File f1) throws IOException {
        File[] f2 = f1.listFiles();
        /*for (int i = 0; i < f2.length; i++) {
            if(f2[i].isDirectory()){
                System.out.println(f2[i]);
            }
        }*/
        for (File f3 : f2) {
            if (f3.isDirectory()) {
                File file = new File("D:\\cc", f3.getName());
                file.mkdirs();
                //String name = f3.getName();
                //String sb = name.substring(name.length() - 3, name.length());
                //System.out.println(sb);
                System.out.println(f3);
            }/*else{
                getI(f3);
            }*/

        }
    }
}
